﻿using AttributeRouting.Web.Http;
//using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Water.Model;

namespace Water.RestService.Controllers
{
    public class MeterReadingController : ApiController
    {

        private MeterReading mr;
       
        [POST("GetMeterReadings")]
        public IList<MeterReading> PostMeterReadings(MeterReadCondition mrc)
        {
            mr = new MeterReading();
            return mr.QueryMeterReading(mrc);
        }
        /*
       [POST("GetMeterReadingsCount")]
       public int PostGetMeterReadingsCount(MeterReading mr)
       {
           var where = MeterReadingWhere(mr);
           int count = mrr.LoadCount(where);
           return count;
       }
        */
       [POST("AddMeterReading")]
       public bool PostAddMeterReading(MeterReading mr)
       {
           mr.MRNO = BuilderMrno.GetMrnoFortbl("Tbt_MeterReading");
           bool result = (mr.AddMeterReading(mr) > 0) ? true : false;
           return result;
       }
        /*
       [POST("EditMeterReading")]
       public bool PostEditMeterReading(MeterReading mr)
       {
           bool result = mrr.Edit(mr);
           return result;
       }

       [GET("DeleteMeterReading/{code}")]
       public bool GetDeleteMeterReading(string code)
       {
           bool result = mrr.Delete(code);
           return result;
       }

       [GET("GetMeterReading/{code}")]
       public MeterReading GetMeterReading(string code)
       {
           var result = mrr.Get(code);
           return result;
       }
       */
    }
}
